package random.fox.p2p.api;


import android.util.Log;

import com.android.volley.NetworkResponse;
import com.android.volley.Response;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.Iterator;
import java.util.Map;
import java.util.Set;

/**
 * Created by wq on 15/3/19.
 */
public class JsonObjectRequest extends com.android.volley.toolbox.JsonObjectRequest {
    private Map<String, String> params;
    private String TAG = getClass().getSimpleName();

    public JsonObjectRequest(String url, ApiClient.CallBack callBack, Map<String, String> params) {
        super(Method.POST,url,callBack, callBack);
        this.params = params;
    }

    public JsonObjectRequest(String url, ApiClient.CallBack callBack, String params) {
        super(Method.POST,url,params.toString(), callBack, callBack);
    }

    @Override
    public Map<String, String> getParams() {
        return params;
    }

    @Override
    protected Response<JSONObject> parseNetworkResponse(NetworkResponse response) {
        Response<JSONObject> jsonObjectResponse = super.parseNetworkResponse(response);
        Log.d(TAG,"network:BACK:\t"+jsonObjectResponse.result);
        return jsonObjectResponse;
    }
}
